package com.syni.mdd.yhd.common.all.config;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import org.apache.commons.lang.StringEscapeUtils;

import java.io.IOException;

/**
 * @className StringRemoveEscape
 * @description TOO
 * @Author cfx
 * @DATE 2019/8/3 12:22
 * @VERSION 1.0
 **/
public class StringRemoveEscape  extends JsonDeserializer<String> {
    @Override
    public String deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
        String source = jsonParser.getText().trim();
        // 把字符串做XSS过滤
        source = source.replaceAll("\\\\","");
        return source;
    }
}
